package com.wny.activities;

import com.wny.R;
import com.wny.backend.SocketsClient;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class ServerIPActivity extends Activity {
	Button confirmBtn;
	OnClickListener confirmListener = null;

	/** Called when the activity is first created. */
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		confirmListener = new OnClickListener() {
			public void onClick(View v) {
				Intent ipIntent = new Intent(ServerIPActivity.this,
						LoginActivity.class);
				setTitle("Server IP");
				String serverIP = ((EditText) findViewById(R.id.serverIP))
						.getText().toString();
				ipIntent.putExtra("ServerIP", serverIP);
				SocketsClient.setSocket(serverIP);
				startActivity(ipIntent);

			}
			
		};
		setContentView(R.layout.serverip);
		confirmBtn = (Button) findViewById(R.id.ipconfirm);
		confirmBtn.setOnClickListener(confirmListener);
	}

}
